package com.lighting.common.feign.search.constant;

import com.fasterxml.jackson.databind.JsonNode;
import org.springframework.core.NamedThreadLocal;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zhanghanjun
 * @date 2022-06-27 18:20
 */
public class SearchConstant {

    public static final String ID = "id";
    public static final String FIELDS = "fields";
    public static final String TYPE = "type";
    public static final String TEXT = "text";
    public static final String KEYWORD = "keyword";
    public static final String DOT_KEYWORD = ".keyword";
    public static final String MAPPINGS = "mappings";
    public static final String PROPERTIES = "properties";
    public static final String ERD_INDEX = "erd_index";
    public static final String _ID = "_id";
    public static final String _SCORE = "_score";
    public static final String ANALYZER = "analyzer";
    public static final String SEARCH_ANALYZER = "search_analyzer";
    public static final String IK_MAX_WORD = "ik_max_word";
    public static final String IK_SMART = "ik_smart";
    public static final String FLEX_ATTRS = "flexAttrs";

    public static final String ASC = "asc";


    /**
     * 更新索引数据前先初始化索引本地配置
     */
    public static boolean initMapping;
    /**
     * ES中查询出来的索引mapping信息
     */
    public static Map<String, Map<String, JsonNode>> mapping = new HashMap<>();

    /**
     * 应用服务索引字段名称对应信息
     */
    public static Map<String, Map<String, String>> indexProperty = new HashMap<>();

    /**
     * 当前线程操作的索引名称
     */
    public static NamedThreadLocal<String> indexName = new NamedThreadLocal<>("indexName");

}
